<?php

namespace App\Providers;

use function foo\func;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Cookie;
use App\model\Adverts;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        view()->composer('admin/*',function($view){
            $name = unserialize(Cookie::get('adminlogin'))['name'];
            $view->with(['adminname'=>$name]);
        });
        view()->composer('web/*',function ($view){
            $db = new Adverts();
            $ad_7 = $db->getad(7);
            $view->with(['xrlm_url'=>$ad_7]);
        });
    }
}
